package com.hlee.xml;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class IncomingImage
{
	private String imageType;
	private String imageName;
	private String imageLocation;
	private String scanOperator;
	private String scanDateString;
	private Map indexAttributesMap;
	private Map validationAttributesMap;
	private Map searchAttributesMap;
	private boolean saveAttributes;
	
	public IncomingImage() 
	{
		indexAttributesMap = new HashMap();
		validationAttributesMap = new HashMap();
		searchAttributesMap = new HashMap();
	}
	
	public String getImageLocation()
	{
		return imageLocation;
	}
	public void setImageLocation(String imageLocation)
	{
		this.imageLocation = imageLocation;
	}
	public String getImageName()
	{
		return imageName;
	}
	public void setImageName(String imageName)
	{
		this.imageName = imageName;
	}
	public String getImageType()
	{
		return imageType;
	}
	public void setImageType(String imageType)
	{
		this.imageType = imageType;
	}
	public String getScanDateString()
	{
		return scanDateString;
	}
	public void setScanDateString(String scanDateString)
	{
		this.scanDateString = scanDateString;
	}
	public String getScanOperator()
	{
		return scanOperator;
	}
	public void setScanOperator(String scanOperator)
	{
		this.scanOperator = scanOperator;
	}
	public Map getSearchAttributesMap()
	{
		return searchAttributesMap;
	}
	public Map getIndexAttributesMap()
	{
		return indexAttributesMap;
	}

	public void setIndexAttributesMap(Map indexAttributesMap)
	{
		this.indexAttributesMap = indexAttributesMap;
	}

	public Map getValidationAttributesMap()
	{
		return validationAttributesMap;
	}

	public void setValidationAttributesMap(Map validationAttributesMap)
	{
		this.validationAttributesMap = validationAttributesMap;
	}

	public void setSearchAttributesMap(Map searchAttributesMap)
	{
		this.searchAttributesMap = searchAttributesMap;
	}

	public boolean isSaveAttributes()
	{
		return saveAttributes;
	}

	public void setSaveAttributes(boolean saveAttributes)
	{
		this.saveAttributes = saveAttributes;
	}

	public void addSearchAttribute(Attribute attribute)
	{
		searchAttributesMap.put(attribute.getName(), attribute.getValue());
	}
	
	public void addIndexAttribute(Attribute attribute)
	{
		indexAttributesMap.put(attribute.getName(), attribute.getValue());
	}
	
	public void addValidationAttribute(Attribute attribute)
	{
		validationAttributesMap.put(attribute.getName(), attribute.getValue());
	}
	
	public String toString()
	{
		StringBuffer buf = new StringBuffer();
		buf.append("<incomingImage")
		   .append("\n  imageType: " + getImageType())
		   .append("\n  imageName: " + getImageName())
		   .append("\n  imageLocation: " + getImageLocation())
		   .append("\n  scanOperator: " + getScanOperator())
		   .append("\n  scanDate: " + getScanDateString())
		   .append("\n  saveAttributes: " + isSaveAttributes());

		buf.append("\n  indexAttributes: ");
		for (Iterator iter = getIndexAttributesMap().entrySet().iterator(); iter.hasNext(); )
		{
			Map.Entry entry = (Map.Entry) iter.next();
			buf.append("\n    attribute name: " + entry.getKey() + ", value: " + entry.getValue());
		}

		buf.append("\n  validationAttributes: ");
		for (Iterator iter = getValidationAttributesMap().entrySet().iterator(); iter.hasNext(); )
		{
			Map.Entry entry = (Map.Entry) iter.next();
			buf.append("\n    attribute name: " + entry.getKey() + ", value: " + entry.getValue());
		}
		
		buf.append("\n  searchAttributes: ");		
		for (Iterator iter = getSearchAttributesMap().entrySet().iterator(); iter.hasNext(); ) 
		{
			Map.Entry entry = (Map.Entry) iter.next();
			buf.append("\n    attribute name: " + entry.getKey() + ", value: " + entry.getValue());
		}
		
		buf.append("\n/incomingImage>\n");

		return buf.toString();
	}
}
